﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using GameEngine;

namespace DaphneTeacher
{
    /// <summary>
    /// Operation on evaluating diagonals which king must have for position to be winning
    /// </summary>
    public enum eDiagonalOperator { AND, OR };

    /// <summary>
    /// Abstract class for diagonal node
    /// </summary>
    public abstract class DiagonalNode
    {
        public DiagonalNode Left
        { get; set; }

        public DiagonalNode Right
        { get; set; }
    }

    /// <summary>
    /// Diagonal placing operator
    /// </summary>
    public class DiagonalOper: DiagonalNode
    {
        public eDiagonalOperator Operator
        { get; set; }

        public DiagonalOper(eDiagonalOperator oper, DiagonalNode left, DiagonalNode right)
        {
            Operator = oper;
            Left = left;
            Right = right;
        }
    }

    /// <summary>
    /// Index of diagonal where king must be put for endgame position to be winning
    /// </summary>
    public class Diagonal : DiagonalNode
    {
        public int DiagonalNumber
        { get; set; }

        public Diagonal(int iNumber)
        {
            DiagonalNumber = iNumber;
        }
    }

    /// <summary>
    /// Enumerable type of positions supported for training
    /// </summary>
    public class PositionType
    {
        /// <summary>
        /// number of white men
        /// </summary>
        public int WM
        { get; set; }

        /// <summary>
        /// number of white kings
        /// </summary>
        public int WK
        { get; set; }

        /// <summary>
        /// number of black men
        /// </summary>
        public int BM
        { get; set; }

        /// <summary>
        /// number of black kings
        /// </summary>
        public int BK
        { get; set; }

        /// <summary>
        /// game type
        /// </summary>
        public enumGameType GameType
        { get; set; }

        public DiagonalNode DiagonalNode
        { get; set; }

        /// <summary>
        /// List of positions
        /// </summary>
        public static List<PositionType> PositionTypes = new List<PositionType>()
        {
            new PositionType() { GameType = enumGameType.Czech, WM = 0, BM = 0, WK = 4, BK = 1, DiagonalNode = null},
            new PositionType() { GameType = enumGameType.Czech, WM = 0, BM = 0, WK = 3, BK = 1, DiagonalNode = new Diagonal(1) },
            new PositionType() { GameType = enumGameType.Czech, WM = 0, BM = 0, WK = 4, BK = 2, 
                    DiagonalNode = new DiagonalOper(eDiagonalOperator.OR, new Diagonal(1), new Diagonal(2)) },
            new PositionType() { GameType = enumGameType.Czech, WM = 0, BM = 0, WK = 5, BK = 3, DiagonalNode = new Diagonal(1) }
            //new PositionTypes() { GameType = enumGameType.Czech, WM = 0, BM = 1, WK = 3, BK = 1},
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
            //new PositionTypes() { GameType = enumGameType.Czech, WM = , BM = , WK =, BK = },
        };
    }


}
